package com.restaurant.application.indexes.bookingsetlist;

import com.nebutown.description.DataTypes;
import com.nebutown.description.IndexGen;
import com.nebutown.description.UnitDescription;
import com.nebutown.description.data.Contributor;
import com.nebutown.description.data.IndexUnit;
import com.nebutown.description.data.SQLColumn;
import com.restaurant.application.bookingset.BookingSet;
import com.restaurant.application.shop.Shop;

public class AssistBookingSetListDesc extends UnitDescription {
    public static void main(String[] args) {
        UnitDescription desc = UnitDescription.basicUnit(AssistBookingSetList.class, null);

        desc
                .addUiFunction("create", null)
                .addUiFunction("edit", null)
                .addUiFunction("delete", null)
                .addUiFunction("search", null)
                .addUiFunction("switchPage", null)
        ;

        desc.run("./");
        IndexGen.run(getDescription(), "src/main/java");
    }

    public static IndexUnit getDescription() {
        return new IndexUnit()
                .withName("BookingSetList")
                .withPackageName(AssistBookingSetListDesc.class.getPackage().getName() + ".mysql")
                .withSrcLocation("./")
                .addContributors(new Contributor()
                        .withName("bookingSet")
                        .withNullable(false)
                        .withUnique(true)
                        .withUnitType(BookingSet.class.getName())
                        .addContribution(new SQLColumn()
                                .withName("id")
                                .withType(DataTypes.STRING)
                                .withLabel("设置Id")
                                .withWidth(255))
                        .addContribution(new SQLColumn()
                                .withName("dates")
                                .withType(DataTypes.STRING)
                                .withLabel("日期段")
                                .withWidth(255))
                        .addContribution(new SQLColumn()
                                .withName("times")
                                .withType(DataTypes.STRING)
                                .withLabel("时间段")
                                .withWidth(255))
                        .addContribution(new SQLColumn()
                                .withName("service")
                                .withType(DataTypes.STRING)
                                .withLabel("服务")
                                .withWidth(255))
                        .addContribution(new SQLColumn()
                                .withName("createTime")
                                .withType(DataTypes.LONG)
                                .withLabel("创建时间")
                                .withFormat("yyyy-MM-dd hh:mm:ss")
                                .withWidth(255))
                        .addContribution(new SQLColumn()
                                .withName("modifyTime")
                                .withType(DataTypes.LONG)
                                .withLabel("修改时间")
                                .withFormat("yyyy-MM-dd hh:mm:ss")
                                .withWidth(255))
                ).addContributors(new Contributor()
                        .withName("shop")
                        .withNullable(false)
                        .withUnique(true)
                        .withUnitType(Shop.class.getName())
                        .addContribution(new SQLColumn()
                                .withName("shopId")
                                .withType(DataTypes.STRING)
                                .withLabel("店铺Id")
                                .withWidth(255))
                        .addContribution(new SQLColumn()
                                .withName("shopName")
                                .withType(DataTypes.STRING)
                                .withLabel("店铺名称")
                                .withWidth(255))
                );
    }
}
